\begin{lstlisting}[language=C++]
avr_op_ADC::avr_op_ADC(word opcode, AvrDevice *c): 
    DecodedInstruction(c),
    R1(get_rd_5(opcode)),
    R2(get_rr_5(opcode)),
    status(c->status) {}

int avr_op_ADC::operator()() { 
    unsigned char rd = core->GetCoreReg(R1);
    unsigned char rr = core->GetCoreReg(R2);
    unsigned char res = rd + rr + status->C;

    status->H = get_add_carry(res, rd, rr, 3);
    status->V = get_add_overflow(res, rd, rr);
    status->N = (res >> 7) & 0x1;
    status->S = status->N ^ status->V;
    status->Z = (res & 0xff) == 0;
    status->C = get_add_carry(res, rd, rr, 7);

    core->SetCoreReg(R1, res);

    return 1;   //used clocks
}
\end{lstlisting}
